Changing the shell path to the same as the lister

back to section start!

  Using the  lister query  command can now allow us to do almost the
opposite of the first  example  given previously.

  This example will allow you to change your current path in a shell by
entering a simple command, to that of the source, destination or any lister,
in that order.
  That is, if there is a source lister you will change to it's path, if there
isn't a source lister, then the first destination lister will be used, if
there isn't a destination lister, then the first non-busy lister will be
used.
  If no non-busy listers are found then a requester will open informing you.

/*
 $VER: CDO.dopus5 1.0 (6.8.98)
 Changes your shell path to lister path
*/
options results
if ~show('P','DOPUS.1') then do        /* Check for DOPUS.1 ARexx port */
  Say "Directory Opus is not running." /* Warn user if Opus not running */
  Exit 5                               /* Exit with result code = 5 (Warn) */
  end                                  /* End this loop */
address 'DOPUS.1'
lister query source                          /* Look for a Source lister */
if result = '' | result ~= 'RESULT' then call gotone /* We've found one */
lister query dest                       /* Look for a Destination lister */
if result = '' | result ~= 'RESULT' then call gotone /* We've found one */
lister query all                         /* Look for any non-busy lister */
if result = '' | result ~= 'RESULT' then call gotone /* We've found one */
dopus request '"No non-busy listers found" OK'     /* We didn't find any */
exit 5                                               /* suitable listers */

gotone:
parse var result handle .     /* Parse the first lister handle */
lister query handle path      /* Ask for it's current path */
path = strip(result,'b','"')  /* Store the path, strip "'s */
push path                     /* Push the result into the input stream */
say pragma('d')
exit

  Press this  button  to copy this script to the DOpus5:ARexx/ directory, open a
lister, then in a shell type:

  rx DOpus5:ARexx/CDO.dopus5

  The shell's current path should now be the same as the lister.

  Hint: Rather than having to type in 'rx DOpus5:ARexx/CDOpus.dopus5' every
time you want to use the script, edit your S:Shell-Startup file and insert
something similar to the following line:

  Alias CDO "rx DOpus5:ARexx/CDOpus.dopus5"

  Now when you type 'CDO' in a shell it will call the above script.

DOpus PLUS - giving you that bit extra...